Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker starts containers with restart policy on-failure after host reset #47846

Open
sammy007 opened this issue May 19, 2024 · 1 comment
Open
Labels
kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. status/0-triage version/26.1

Comments

@sammy007
Copy link

Description

It's a host failure, not a container failure so none policy should apply in such case. There is literally no way to make docker to act as supervisor for a container which only restarts it in case of container failure.

Reproduce

  1. create docker container with on-failure policy
  2. restart docker
  3. docker ps => 0 containers

a. create docker container with on-failure policy
b. reset HOST
c. docker ps => 1 container

Expected behavior

Do not start container with restart policy set to on-failure after host reset.

docker version

Client: Docker Engine - Community
 Version:           26.1.3
 API version:       1.45
 Go version:        go1.21.10
 Git commit:        b72abbb
 Built:             Thu May 16 08:33:42 2024
 OS/Arch:           linux/amd64
 Context:           default

docker info

Client: Docker Engine - Community
 Version:    26.1.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.14.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.27.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Additional Info

No response

@sammy007 sammy007 added kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. status/0-triage labels May 19, 2024
@mschfh
Copy link

mschfh commented May 26, 2024

I noticed the same issue (with GitHub Codespaces).

The container is started when the Codespace is launched and the docker daemon is started, even if on-failure or unless-stopped is used as restart policy, according to the documentation this shouldn't happen:

on-failure: [...] It doesn't restart the container if the daemon restarts.
unless-stopped: Similar to always, except that when the container is stopped (manually or otherwise), it isn't restarted even after Docker daemon restarts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. status/0-triage version/26.1
Projects
None yet
Development

No branches or pull requests

3 participants